package cn.edu.lingnan;
import cn.edu.lingnan.bean.User;
import cn.edu.lingnan.service.user.UserService;
import cn.hutool.core.date.DateUtil;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.Date;

@SpringBootTest
public class Usertest {

    @Resource
    UserService userService;

    @Test
    public void userSaveTest(){

        for (int i = 0; i < 5; i++ ){
            User user = new User();
            user.setUserName("用户0"+i);
            user.setPassWord("密码0"+i);
            user.setIphone("1008600"+i);

            String createTime = DateUtil.now();
            user.setCreateTime(createTime);
            userService.saveUser(user);
        }

    }

    @Test
    public void loginTest(){
        User login = userService.login("用户01", "密码01");
        if(login != null){
            System.out.println("登录成功");
            System.out.println(login+"=====login对象数据");
        }else {
            System.out.println("登录失败");
            System.out.println(login+"=====login对象数据");
        }
    }

}
